package com.txy.webmanagement.control;

import com.txy.webmanagement.model.SysProduct;
import com.txy.webmanagement.service.SysProductService;
import com.txy.webmanagement.utils.RequestDataUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 产品管理
 *
 * @author wf
 * @date 2019-01-01$
 **/
@Controller
@RequestMapping(value = "product")
public class ProductControl {
    @Autowired
    private SysProductService sysProductService;

    @RequestMapping(value = "index")
    public String index() {

        return "product/index";
    }

    @RequestMapping(value = "gotoSave")
    public String gotoSave() {


        return "product/add";
    }

    @RequestMapping(value = "ajaxProductList")
    @ResponseBody
    public RequestDataUtils ajaxProductList(SysProduct pd) {
        RequestDataUtils req = new RequestDataUtils();
        List<SysProduct> li = sysProductService.pageList(pd);
        req.setData(li);
        return req;
    }

    @RequestMapping(value = "info")
    public String info() {



        return "product/info";
    }
}